// 1.引入vue
import Vue from 'vue';
// 2.引入vuex
import Vuex  from 'vuex';
import state from './state';
import mutations from './mutations';
import getters from './getters'
// 6.引入modules.js模块
import moduleA from './moduleA'
import moduleB from "./moduleB";
// 3.使用vuex模块
Vue.use(Vuex);
// 4.创建Vuex实例
const store = new Vuex.Store({
  state: state,
  mutations: mutations,
  getters: getters,
  modules: {
    moduleA,
    moduleB
  }
});
// 5.导出store
export default store;
// const store = new Vuex.Store({
//   state: {
//     city_name: defaultCityName,
//     area_name: "中原区"
//   },
//   actions: {
//     changeCity(ctx, cname) {
//       // console.log(cname)
//       ctx.commit('changeCity',cname)
//     }
//   },
//   mutations: {
//     changeCity(state,cname) {
//       state.city_name = cname;
//       // localStorage.city_name = cname;
//       try {
//         localStorage.city_name = cname;
//       } catch (error) {
        
//       }
//     }
//   }
// });